package com.ruoyi.common.pms.service.impl;

import com.ruoyi.common.business.dao.YytCompanyMapper;
import com.ruoyi.common.pms.dao.YytShopMemberMapper;
import com.ruoyi.common.pms.entity.YytShop;
import com.ruoyi.common.pms.dao.YytShopMapper;
import com.ruoyi.common.pms.service.YytShopMemberService;
import com.ruoyi.common.pms.service.YytShopService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 店铺表 服务实现类
 * </p>
 *
 * @author huangshun
 * @since 2021-12-16
 */
@Service
public class YytShopServiceImpl extends ServiceImpl<YytShopMapper, YytShop> implements YytShopService {
    @Autowired
    private YytShopMapper yytShopMapper;
    @Autowired
    private YytCompanyMapper yytCompanyMapper;
    @Autowired
    private YytShopMemberMapper yytShopMemberMapper;


    @Override
    public List<YytShop> getMyShopAll(String wechatId) {
//        return yytShopMapper.getMyShopAll(wechatId);
        return yytShopMemberMapper.getMyShopAll(wechatId);
    }

    @Override
    public YytShop selectYytShopById(String shopId) {
        YytShop yytShop = yytShopMapper.selectById(shopId);
        System.out.println(yytShop);
        if (yytShop == null){
            return null;
        }
        yytShop.setCompany(yytCompanyMapper.getByShopId(yytShop.getId()));
        return yytShop;
    }
}
